#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
const int N=410;
int stepcnt[N][N];

int dx[8]={1,1,-1,-1,-2,-2,2,2};
int dy[8]={2,-2,2,-2,-1,1,-1,1};
typedef pair<int,int> PII;
int main()
{
	int n,m,x,y;cin>>n>>m>>x>>y;

	memset(stepcnt,-1,sizeof(stepcnt));
	queue<PII> q;
	q.push({x,y});
	stepcnt[x][y]=0;

	while(q.size())
	{
		auto coordinate=q.front();
		int Horizontal=coordinate.first;
		int Vertical=coordinate.second;
		q.pop();
		for(int i=0;i<8;i++)
		{
			int newHorizontal=Horizontal+dx[i];
			int newVertical=Vertical+dy[i];

			if(newHorizontal>=1&&newHorizontal<=n
				&&newVertical>=1&&newVertical<=m&&stepcnt[newHorizontal][newVertical]==-1)
			{
				stepcnt[newHorizontal][newVertical]=
				stepcnt[Horizontal][Vertical]+1;

				q.push({newHorizontal,newVertical});
			}
		}
	}

	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cout<<stepcnt[i][j]<<" ";
		}
		cout<<endl;
	}
}